package com.oracle.oa.biz.impl;

import java.util.List;

import com.oracle.oa.biz.MessageToUserBiz;
import com.oracle.oa.dao.MessageToUserDao;
import com.oracle.oa.dao.impl.MessageToUserDaoImpl;
import com.oracle.oa.entity.Messagetouser;


public class MessageToUserBizImpl extends BaseBizImpl implements
		MessageToUserBiz {

	MessageToUserDao mtudao;
	
	
	public int getByUserid(Object value) {
		int count=0;
		List<Messagetouser> list = mtudao.getByProperty(Messagetouser.class, "userinfo.userid", value);
		if(list!=null&&list.size()>0){
			count=list.size();
		}
		return count;
	}
	
	
	public int getByTouseridAndIfread(Object touserid, Object ifread) {
		int count=0;
		
		List<Messagetouser> list = mtudao.getByTouseridAndIfread(touserid, ifread);
		
		if(list!=null&&list.size()>0){
			count=list.size();
		}
		
		return count;
	}

	
	public int getuserGroupByAnddistinct(Object messageid) {
		int count = Integer.parseInt(((List)mtudao.getuserGroupByAnddistinct(messageid)).get(0).toString());		
 		return count;
	}

	
	
	public int deleteBymessageid(Object messageid) {
		 return mtudao.deleteBymessageid(messageid);		
	}

	public MessageToUserDao getMtudao() {
		return mtudao;
	}

	public void setMtudao(MessageToUserDao mtudao) {
		this.mtudao = mtudao;
	}

	
	
}
